home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Floppyshop 2
/
Floppyshop - 2.zip
/
Floppyshop - 2.iso
/
art&graf.ix
/
art-3718
/
extendpi
/
read_me.s
< prev
Wrap
Text File
|
1993-03-02
|
8KB
|
340 lines
********************************************************************************
*
* Have you ever tried to load a PI1 format picture into Deluxe Paint
* and got this error message:
*
* 'Unable to open file. The
* file is non-existent or
* a drive error occurred.'
*
* even though the picture is there on the screen? It is possible
* that the palette is incorrect and the last screen line may be
* corrupted.
*
* If you have this problem, check the length of the file. Deluxe
* Paint expects a PI1 file to be 32066 bytes long, although many
* other packages can handle PI1s 32034 bytes long. PicSwitch 0.7
* seems to be fond of this size.
*
* If your file is 32034 bytes long, this program should solve your
* problem. If not, then you have my commiserations. If the file
* is 32034 bytes long and this program doesn't fix things, and the
* problem isn't a disk fault, you could always drop me a line with
* a copy of the file - I'd be interested to see it and I might be
* able to fix it. (I can't guarantee it though.)
*
* The missing 32 bytes actually contain information used in colour
* cycling, so are normally zeroes anyway. This program scans your
* disk for PI1s, PI2s, and PI3s 32034 bytes long, loads them into
* memory, creates a blank colour cycling table and rewrites them
* to disk. (NB This doesn't require extra disk space as files
* 32034 and 32066 bytes long both use 32 clusters.)
*
* This program and source code/documentation are completely free
* and are distributed with no strings attached. However, I do
* assert my right to be identified as the author of this software
* in accordance with the Copyright, Designs and Patents Act 1988.
*
* If you find this program useful, please let me know. I don't
* believe in moral blackmail so I won't ask you for anything, but
* a couple of quid, a blank disk or two, picture files, PD or just
* a letter would be equally acceptable, as would recommendations
* for improvements and future developments. Whatever you send,
* you're likely to get back:
*
* A self-extracting archive creator
*
* Details on how to get 70+ PI1 pictures on a disk, and not
* have to mess about with an unpacker to display them or work
* on them.
*
* Anything interesting that I write between now (2/93) and
* then.
*
* Much as I would like to, I cannot accept any responsibility for
* loss or damage, material or notional, caused by the use or misuse
* of this program. As far as I know, it works as described, but if
* it doesn't, let me know.
*
* Deluxe Paint is copyright by Artistech Developments 1990 and is
* distributed in the UK by Electronic Arts.
*
* Write to:
*
* Dave Jones,
* 100, Radford Road,
* Hyson Green,
* Nottingham,
* NG7 5FU,
* ENGLAND
*
********************************************************************************
*
* Assembler control directives
*
output extendpi.tos
opt o1+,o2+,ow-
*
********************************************************************************
*
* Constants for trap instruction
*
GEMDOS equ $01
XBIOS equ $0e
*
********************************************************************************
*
* Constants for GEMDOS functions
*
CRAWCIN equ $07
CCONWS equ $09
FSETDTA equ $1a
FCREATE equ $3c
FOPEN equ $3d
FCLOSE equ $3e
FREAD equ $3f
FWRITE equ $40
PTERM equ $4c
FSFIRST equ $4e
FSNEXT equ $4f
*
********************************************************************************
*
* Constants for XBIOS functions
*
CURSCONF equ $15
*
********************************************************************************
*
* Constants for XBIOS $15 - CursConf
*
CURS_OFF equ $00
CURS_ON equ $01
*
********************************************************************************
*
* The file sizes involved. We want to convert short-sized PI?s to
* long-sized ones.
*
SHORT_SIZE equ 32034
LONG_SIZE equ 32066
*
*
********************************************************************************
*
* Macros for frequent functions
*
pstring MACRO
pea \1
move.w #CCONWS,-(a7)
trap #GEMDOS
addq.l #6,a7
ENDM
*
cursor MACRO
move.w #CURSCONF,-(a7)
trap #XBIOS
addq.l #4,a7
ENDM
*
getkey MACRO
move.w #CRAWCIN,-(a7)
trap #GEMDOS
addq.l #2,a7
ENDM
*
********************************************************************************
*
* Code starts here
*
********************************************************************************
start * no error yet
clr.w return_code
* hide cursor
move.w #CURS_OFF,-(a7)
cursor
* say hello
pstring banner
getkey
cmp.b #' ',d0 space continues
bne exit anything else exits
* set dta
pea dta our buffer
move.w #FSETDTA,-(a7)
trap #GEMDOS
addq.l #6,a7
* find first
clr.w -(a7) normal file r/w
pea file_spec *.PI?
move.w #FSFIRST,-(a7)
trap #GEMDOS
addq.l #8,a7
tst.l d0 -ve = no files
bmi no_files
loop * check size
cmpi.l #SHORT_SIZE,size
bne skip
* display file name
pstring process
pstring name
* read file
clr.w -(a7)
pea name
move.w #FOPEN,-(a7)
trap #GEMDOS
addq.l #8,a7
tst.l d0
bmi error
move.w d0,-(a7) put handle on stack for later
pea buffer
pea SHORT_SIZE
move.w d0,-(a7)
move.w #FREAD,-(a7)
trap #GEMDOS
lea 12(a7),a7
tst.l d0
bmi error
move.w #FCLOSE,-(a7) handle's there already
trap #GEMDOS
addq.l #4,a7
tst.l d0
bmi error
* clear end
lea buffer+SHORT_SIZE,a0
moveq #LONG_SIZE-SHORT_SIZE-1,d0
clear clr.b (a0)+
dbf d0,clear
* write file
clr.w -(a7)
pea name
move.w #FCREATE,-(a7)
trap #GEMDOS
addq.l #8,a7
tst.l d0
bmi error
move.w d0,-(a7) put handle on stack for later
pea buffer
pea LONG_SIZE
move.w d0,-(a7)
move.w #FWRITE,-(a7)
trap #GEMDOS
lea 12(a7),a7
tst.l d0
bmi.s error
move.w #FCLOSE,-(a7) handle's there already
trap #GEMDOS
addq.l #4,a7
tst.l d0
bmi.s error
pstring done
skip * find next
move.w #FSNEXT,-(a7)
trap #GEMDOS
addq.l #2,a7
tst.l d0
bmi.s no_more_files
bra loop
no_files pstring empty
bra.s exit
no_more_files pstring more fall through to exit
exit pstring end_message
getkey
* show cursor
move.w #CURS_ON,-(a7)
cursor
move.w return_code,-(a7) error code (if any)
move.w #PTERM,-(a7)
trap #GEMDOS
error move.w d0,return_code
pstring error_msg
bra.s exit
file_spec dc.b "*.pi?",0
banner dc.b $1b,"E"
dc.b "Extend PI1-3 files - ZZD '93"
dc.b $0d,$0a
dc.b "~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
dc.b $0d,$0a
dc.b $0d,$0a
dc.b "Space to continue, any other key to exit"
dc.b $0d,$0a
dc.b $0d,$0a
dc.b 0
empty dc.b "There are no PI? files in this directory"
dc.b $0d,$0a
dc.b 0
more dc.b $0d,$0a
dc.b "All files processed"
dc.b $0d,$0a
dc.b 0
process dc.b "Processing "
dc.b 0
done dc.b " - done"
dc.b $0d,$0a
dc.b 0
end_message dc.b $0d,$0a
dc.b "Press any key to exit"
dc.b $0d,$0a
dc.b 0
error_msg dc.b $0d,$0a
dc.b "A fatal error has occurred"
dc.b $0d,$0a
dc.b 0
even
bss
dta
reserved ds.b 21 reserved for GEM
attribute ds.b 1
time ds.b 2 time and
date ds.b 2 date of file creation
size ds.b 4 file length (long)
name ds.b 14 file name
return_code ds.w 1
buffer ds.w 16033